#include "random.hh"

random_index_t::random_index_t(int K): kmax(K)
{
#ifdef DEBUG
  assert( K > 1 );
#endif
  RandGen = new boost::random::mt19937(time(0));
}

random_index_t::~random_index_t()
{
  delete RandGen;
}

int
random_index_t::operator () ()
  const
{
  boost::random::uniform_int_distribution<> dist(0,kmax-1);
  return dist(*RandGen);
}

int
random_index_t::operator () (int K)
  const
{
#ifdef DEBUG
  assert( K > 1 );
#endif
  boost::random::uniform_int_distribution<> dist(0,K-1);
  return dist(*RandGen);
}
